<!--#INCLUDE FILE="config.asp"-->
<%
dim count
dim number
Dim myArray()

if (Request("countTravel") <> "") then
	count = CInt(Request("countTravel"))
end if 

ReDim myArray(count)

For i = 0 To count - 1
	if (Request("travelID1_"&(i+1)) <> "") then
		myArray(i) = Request("travelID1_"&(i+1))
	elseif (Request("travelID2_"&(i+1)) <> "") then
		myArray(i) = Request("travelID2_"&(i+1))
	end if
next

	reason = Request("reason")
	gId = Request("guesId")
	number = 0
	For Each item In myArray
number = number + 1
		set objConnect = server.createObject("ADODB.Connection")       
		objConnect.open conStr

		Set oCmd = Server.CreateObject("ADODB.Command")

		oCmd.ActiveConnection = objConnect
		oCmd.CommandText = "sp_denied_travel" 
		oCmd.CommandType = 4

		Set reason1 = oCmd.CreateParameter("@reason", 200,1,100, reason)
		oCmd.Parameters.Append reason1
		
		Set id = oCmd.CreateParameter("@id", 3,1,100, CInt(item))
		oCmd.Parameters.Append id
		
		Set guestsID = oCmd.CreateParameter("@guestsID", 3,1,100, gId)
		oCmd.Parameters.Append guestsID

		Set countTravel = oCmd.CreateParameter("@countTravel", 3,1,100, count)
		oCmd.Parameters.Append countTravel
		
		Set numberOfDeny = oCmd.CreateParameter("@numberOfDeny", 3,1,100, number)
		oCmd.Parameters.Append numberOfDeny
		
		Set userid = oCmd.CreateParameter("@userid", 3,1,100,session("CostabajaId"))
			oCmd.Parameters.Append userid

		set rss = oCmd.execute
	next
	Response.Redirect("costabaja-dashboard.asp" )
%>